import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from "../views/home/Home";//直接加载
const Cart =()=>import("views/cart/Cart");//懒加载
import Profile from "../views/profile/Profile";
import Category from "../views/category/Category";

Vue.use(VueRouter);

  const routes = [
    {
      path:'',
      redirect:'/home'
    },
    {
      path: '/home',
      component:Home,
      meta:{
        title:'首页'
      }
    },
    {
      path: '/profile',
      component:Profile,
      meta:{
        title:'个人'
      }
    },
    {
      path: '/cart',
      component:Cart,
      meta:{
        title:'购物车'
      }
    },
    {
      path: '/category',
      component:Category,
      meta:{
        title:'分类'
      }
    },
  /*{
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/!* webpackChunkName: "about" *!/ '../views/About.vue')
  }*/
]

const router = new VueRouter({
  routes
})

export default router
